package cn.jinbyte.starter.captcha.service;

import cn.jinbyte.starter.captcha.model.AbstractCaptcha;

import java.util.Map;

/**
 * 基于本地内存默认的存储实现
 */
public class DefaultCaptchaStore implements CaptchaStore {
    private static final Map<String, AbstractCaptcha> CACHE = new java.util.concurrent.ConcurrentHashMap<>();

    @Override
    public void put(String key, AbstractCaptcha captcha) {
        CACHE.put(key, captcha);
    }

    @Override
    public AbstractCaptcha get(String key) {
        return CACHE.get(key);
    }

    @Override
    public void remove(String key) {
        CACHE.remove(key);
    }
}
